<!doctype html>
<%@page contentType="text/html;charset=UTF-8"%>
<jsp:directive.page import="com.cn.ccp.bean.UserBean" />
<%@taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
<%@taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
<%@ taglib uri="https://ajax4jsf.dev.java.net/ajax" prefix="a4j"%>
<html>
<f:view>
<f:loadBundle var="messages" basename="messages"></f:loadBundle>
<head>
<meta charset="utf-8">
<title><h:outputText value="#{messages['course_page_course_evaluation_title']}" /></title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="description" content="">
    <meta name="author" content="">

    <!-- styles -->
    <link href="<%=request.getContextPath()%>/css/bootstrap.css" rel="stylesheet">
    <link href="<%=request.getContextPath()%>/css/bootstrap-responsive.css" rel="stylesheet">
    <link href="<%=request.getContextPath()%>/css/custom.css" rel="stylesheet">
    <link rel="stylesheet" href="<%=request.getContextPath()%>/themes/default/default.css" />
	<link rel="stylesheet" href="<%=request.getContextPath()%>/plugins/code/prettify.css" />
	<script charset="utf-8" src="<%=request.getContextPath()%>/kindeditor.js"></script>
	<script charset="utf-8" src="<%=request.getContextPath()%>/lang/zh_CN.js"></script>
	<script charset="utf-8" src="<%=request.getContextPath()%>/plugins/code/prettify.js"></script>
    <!--[if lt IE 9]>
      <script src="../../../js/html5.js"></script>
    <![endif]-->
    <!-- Fav and touch icons -->
    <link rel="apple-touch-icon-precomposed" sizes="144x144" href="<%=request.getContextPath()%>/images/icon/apple-touch-icon-144-precomposed.png">
    <link rel="apple-touch-icon-precomposed" sizes="114x114" href="<%=request.getContextPath()%>/images/icon/apple-touch-icon-114-precomposed.png">
    <link rel="apple-touch-icon-precomposed" sizes="72x72" href="<%=request.getContextPath()%>/images/icon/apple-touch-icon-72-precomposed.png">
    <link rel="apple-touch-icon-precomposed" href="<%=request.getContextPath()%>/images/icon/apple-touch-icon-57-precomposed.png">
    <link rel="shortcut icon" href="<%=request.getContextPath()%>/images/icon/favicon.png">
    <%
    	String path = request.getContextPath();
   		String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";

		UserBean users = (UserBean) session.getAttribute("userBean");
			if ((users == null) || (users.getUserName().equals(""))) {
	%>
		<jsp:forward page="../../../sessionInvalid.jsp" />
	<%
	}
	%>
	<script>
		KindEditor.ready(function(K) {
			var editor1 = K.create('textarea[name="content1"]', {
				cssPath : '<%=basePath%>/plugins/code/prettify.css',
				uploadJson : '<%=basePath%>/jsp/upload_json.jsp',
				fileManagerJson : '<%=basePath%>/jsp/file_manager_json.jsp',
				allowFileManager : true,
				afterCreate : function() {
					var self = this;
					K.ctrl(document, 13, function() {
						self.sync();
						//document.forms['example'].submit();
						document.getElementById("formid").submit();
					});
					K.ctrl(self.edit.doc, 13, function() {
						self.sync();
						document.getElementById("formid").submit();
						//document.forms['example'].submit();
					});
				}
			});
			 //editor1.toolbar.remove();
			 editor1.statusbar.remove(); 
			 prettyPrint();
			
		});
	
		
		
	</script>
	
	
</head>
<base href="<%=basePath%>">
<body class="bg-white" onload="showOutline()" style="overflow-x:hidden;">
<a id="viewDiv"></a>
<h:form id="formid">
	<h:inputHidden value="#{courseEvaluationAction.courseId}" ></h:inputHidden>
	<h:inputHidden value="#{courseEvaluationAction.outline.id}" ></h:inputHidden>
	<h:inputHidden value="#{courseEvaluationAction.outline.contents}" id="hideOutlineId"></h:inputHidden>
	<div class="content">
			<div class="row page-head">
				<h3 class="page-title">
					<i class="n-icon-laptop n-icon-black"></i>
					<h:outputText value="#{messages['course_page_course_evaluation_title']}"/>&nbsp;&gt;&nbsp;<h:outputText value="#{courseEvaluationAction.courseName}"/>
				</h3>
			</div>

			<div style="margin-left: 20px; margin-right: 20px">
				<fieldset>
					 <div class="answer">
                      	<div class="control-group">
                         	<textarea name="content1" id="outlineContentsID" cols="100" rows="8" style="width:90%;height:500px;visibility:hidden;">
                         		<h:outputText value="#{courseEvaluationAction.evaluationContent}"/>
                         	</textarea>
                       	</div>
                       	<h:commandButton value="#{messages['btn_submit']}" styleClass="btn btn-primary" action="#{courseEvaluationAction.commint}" />
                       	<h:commandButton value="#{messages['btn_back']}" styleClass="btn" action="main" />
						 <a4j:outputPanel ajaxRendered="true">
							<h:message for="content1" style="color:red"></h:message>
						</a4j:outputPanel>
                        <hr />
                    </div>
					 
					
				</fieldset>
			</div>
	</div>		
	
</h:form>
</body>
</f:view>
<script> 
	
	function showOutline(){
		//alert(document.getElementById("formid:hideOutlineId").value);
		//document.getElementById("outlineContents").value = document.getElementById("formid:hideOutlineId").value;
    }
	$(document).ready(function() {
		//document.getElementById('viewDiv').scrollIntoView();
	});
</script>
</html>
<%!
private String htmlspecialchars(String str) {
	str = str.replaceAll("&", "&amp;");
	str = str.replaceAll("<", "&lt;");
	str = str.replaceAll(">", "&gt;");
	str = str.replaceAll("\"", "&quot;");
	return str;
}
%>